import request from '@/utils/request'

const api = {
  user: '/system/sysUser',
  dept: '/system/sysDept',
  role: '/system/sysRole'
}

export default api

export function getDeptListEnable (parameter) {
  return request({
    url: api.dept + '/getSysDeptAll',
    method: 'get',
    params: parameter
  })
}
// user
export function getUserList (parameter) {
  return request({
    url: api.user + '/getSysUserPageList',
    method: 'get',
    params: parameter
  })
}

export function getUser (userId) {
  return request({
    url: api.user + '/getSysUserInfo/' + `${userId}`,
    method: 'get'
  })
}
export function saveUser (parameter) {
  return request({
    url: api.user + (parameter.userId > 0 ? '/modifySysUser' : '/saveSysUser'),
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
export function delUser (parameter) {
  return request({
    url: api.user + '/removeSysUser',
    method: 'delete',
    params: parameter
  })
}
export function changUserStatus (parameter) {
  return request({
    url: api.user + '/changeUserStatus',
    method: 'put',
    data: parameter
  })
}
export function resetPwd (parameter) {
  return request({
    url: api.user + '/resetPwd',
    method: 'put',
    data: parameter
  })
}
export function getRoleAll () {
  return request({
    url: api.role + '/getRoleList',
    method: 'get'
  })
}
